package com.chw.shop.controller;

import com.chw.common.diy.CommonData;
import com.chw.common.returnData.ReturnData;
import com.chw.shop.entity.po.CarData;
import com.chw.shop.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("authshopping")
public class AuthShopping {
    @Autowired
    private CarService carService;
    @Autowired
    private RedisTemplate redisTemplate;
    @RequestMapping("queryRedisCar")
    public ReturnData queryRedisCar(){
       List<CarData>  carData= (List<CarData>) redisTemplate.opsForHash().get(CommonData.REDIS_CAR_INFO_ID+CommonData.PRO,"222");

        return ReturnData.success(carData);
    }
    @RequestMapping("addcarinfo")
    public ReturnData addCarInfo(Integer id,Integer sid,Integer count){
        carService.addCarInfo(id,sid,count);
        return ReturnData.success("");
    }
}
